from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare


def generate_launch_description():

    inputJS = Node(
        package="input",
        executable="joystick",
        name="js_input",
        output="screen",
    )

    dynamic_robot = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            PathJoinSubstitution(
                [
                    FindPackageShare("controller"),
                    "launch",
                    "dynamic_robot_with_controller.launch.py",
                ]
            )
        )
    )

    return LaunchDescription(
        [
            inputJS,
            dynamic_robot
        ]
    )
